<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title>pstdElastic3D :: Functions (k-Wave)</title>
	<link rel="stylesheet" href="kwavehelpstyle.css" type="text/css">
</head>

<body>
<div class="content">

<h1>pstdElastic3D</h1>
<p class="purpose">3D time-domain simulation of elastic wave propagation.</p>

<h2>Syntax</h2>

<pre class="codeinput">
sensor_data = pstdElastic3D(kgrid, medium, source, sensor)
sensor_data = pstdElastic3D(kgrid, medium, source, sensor, ...) 
</pre>

<h2>Description</h2>
<p><code>pstdElastic3D</code> simulates the time-domain propagation of elastic waves through a three-dimensional homogeneous or heterogeneous medium given four input structures: <code>kgrid</code>, <code>medium</code>, <code>source</code>, and <code>sensor</code>. The computation is based on a pseudospectral time domain model which accounts for viscoelastic absorption and heterogeneous material parameters. At each time-step (defined by <code>kgrid.dt</code> and <code>kgrid.Nt</code> or <code>kgrid.t_array</code>), the wavefield parameters at the positions defined by <code>sensor.mask</code> are recorded and stored. If <code>kgrid.t_array</code> is set to <code>'auto'</code>, this array is automatically generated using the <code>makeTime</code> method of the <code><a href="kWaveGrid.html">kWaveGrid</a></code> class. An anisotropic absorbing boundary layer called a perfectly matched layer (PML) is implemented to prevent waves that leave one side of the domain being reintroduced from the opposite side (a consequence of using the FFT to compute the spatial derivatives in the wave equation). This allows infinite domain simulations to be computed using small computational grids.</p>

<p>An initial pressure distribution can be specified by assigning a matrix of pressure values the same size as the computational grid to <code>source.p0</code>. This is then assigned to the normal components of the stress within the simulation function. A time varying stress source can similarly be specified by assigning a binary matrix (i.e., a matrix of 1's and 0's with the same dimensions as the computational grid) to <code>source.s_mask</code> where the 1's represent the grid points that form part of the source. The time varying input signals are then assigned to <code>source.sxx</code>, <code>source.syy</code>, <code>source.szz</code>, <code>source.sxy</code>, <code>source.sxz</code>, and <code>source.syz</code>. These can be a single time series (in which case it is applied to all source elements), or a matrix of time series following the source elements using MATLAB's standard column-wise linear matrix index ordering. A time varying velocity source can be specified in an analogous fashion, where the source location is specified by <code>source.u_mask</code>, and the time varying input velocity is assigned to <code>source.ux</code>, <code>source.uy</code>, and <code>source.uz</code>.</p>

<p>The field values are returned as arrays of time series at the sensor locations defined by <code>sensor.mask</code>. This can be defined in three different ways. (1) As a binary matrix (i.e., a matrix of 1's and 0's with the same dimensions as the computational grid) representing the grid points within the computational grid that will collect the data. (2) As the grid coordinates of two opposing corners of a cuboid in the form [x1; y1; z1; x2; y2; z2]. This is equivalent to using a binary sensor mask covering the same region, however, the output is indexed differently as discussed below. (3) As a series of Cartesian coordinates within the grid which specify the location of the pressure values stored at each time step. If the Cartesian coordinates don't exactly match the coordinates of a grid point, the output values are calculated via interpolation. The Cartesian points must be given as a 3 by N matrix corresponding to the x, y, and z positions, respectively, where the Cartesian origin is assumed to be in the center of the grid. If no output is required, the <code>sensor</code> input can be replaced with an empty array <code>[]</code>. 

<p>If <code>sensor.mask</code> is given as a set of Cartesian coordinates, the computed <code>sensor_data</code> is returned in the same order. If <code>sensor.mask</code> is given as a binary matrix, <code>sensor_data</code> is returned using MATLAB's standard column-wise linear matrix index ordering. In both cases, the recorded data is indexed as <code>sensor_data(sensor_point_index, time_index)</code>. For a binary sensor mask, the field values at a particular time can be restored to the sensor positions within the computation grid using <code><a href="unmaskSensorData.html">unmaskSensorData</a></code>. If <code>sensor.mask</code> is given as a list of cuboid corners, the recorded data is indexed as <code>sensor_data(cuboid_index).p(x_index, y_index, z_index, time_index)</code>, where <code>x_index</code>, <code>y_index</code>, and <code>z_index</code> correspond to the grid index within the cuboid, and <code>cuboid_index</code> corresponds to the number of the cuboid if more than one is specified.</p>

<p>By default, the recorded acoustic pressure field is passed directly to the output <code>sensor_data</code>. However, other acoustic parameters can also be recorded by setting <code>sensor.record</code> to a cell array of the form <code>{'p', 'u', 'p_max', ...}</code>. For example, both the particle velocity and the acoustic pressure can be returned by setting <code>sensor.record = {'p', 'u'}</code>. If <code>sensor.record</code> is given, the output <code>sensor_data</code> is returned as a structure with the different outputs appended as structure fields. For example, if <code>sensor.record = {'p', 'p_final', 'p_max', 'u'}</code>, the output would contain fields <code>sensor_data.p</code>, <code>sensor_data.p_final</code>, <code>sensor_data.p_max</code>, <code>sensor_data.ux</code>, <code>sensor_data.uy</code>, and <code>sensor_data.uz</code>. Most of the output parameters are recorded at the given sensor positions and are indexed as <code>sensor_data.field(sensor_point_index, time_index)</code> or <code>sensor_data(cuboid_index).field(x_index, y_index, z_index, time_index)</code> if using a sensor mask defined as cuboid corners. The exceptions are the averaged quantities (<code>'p_max'</code>, <code>'p_rms'</code>, <code>'u_max'</code>, <code>'p_rms'</code>, <code>'I_avg'</code>), the 'all' quantities (<code>'p_max_all'</code>, <code>'p_min_all'</code>, <code>'u_max_all'</code>, <code>'u_min_all'</code>), and the final quantities (<code>'p_final'</code>, <code>'u_final'</code>). The averaged quantities are indexed as <code>sensor_data.p_max(sensor_point_index)</code> or <code>sensor_data(cuboid_index).p_max(x_index, y_index, z_index)</code> if using cuboid corners, while the final and 'all' quantities are returned over the entire grid and are always indexed as <code>sensor_data.p_final(nx, ny, nz)</code>, regardless of the type of sensor mask.

<p><code>pstdElastic3D</code> may also be used for time reversal image reconstruction by assigning the time varying pressure recorded over an arbitrary sensor surface to the input field <code>sensor.time_reversal_boundary_data</code>. This data is then enforced in time reversed order as a time varying Dirichlet boundary condition over the sensor surface given by <code>sensor.mask</code>. The boundary data must be indexed as <code>sensor.time_reversal_boundary_data(sensor_point_index, time_index)</code>. If <code>sensor.mask</code> is given as a set of Cartesian coordinates, the boundary data must be given in the same order. An equivalent binary sensor mask (computed using nearest neighbour interpolation) is then used to place the pressure values into the computational grid at each time step. If <code>sensor.mask</code> is given as a binary matrix of sensor points, the boundary data must be ordered using MATLAB's standard column-wise linear matrix indexing. If no additional inputs are required, the <code>source</code> input can be replaced with an empty array <code>[]</code>.</p>

<h2>Inputs</h2>

<p>The minimum fields that must be assigned to run an initial value problem (for example, a photoacoustic forward simulation) are marked with a *.</p>

<table class="body">

    <tr valign="top">
        <td width = "150"><code>kgrid*</code></td>
        <td>k-Wave grid object returned by <code><a href="kWaveGrid.html">kWaveGrid</a></code> containing Cartesian and k-space grid fields</td>
    </tr>    
    
    <tr valign="top">
        <td width = "150"><code>kgrid.t_array*</code></td>
        <td>
            <p>evenly spaced array of time values [s] (set to <code>'auto'</code> by <code><a href="kWaveGrid.html">kWaveGrid</a></code>)</p>
        </td>
    </tr>  
    
    <tr valign="top">
        <td>&nbsp</td>
        <td>&nbsp</td>
    </tr>       
    
    <tr valign="top">
        <td><code>medium.sound_speed_compression*</code></td>
        <td>compressional sound speed distribution within the acoustic medium [m/s]</td>
    </tr>  

    <tr valign="top">
        <td><code>medium.sound_speed_shear*</code></td>
        <td>shear sound speed distribution within the acoustic medium [m/s]</td>
    </tr>   
 		
    <tr valign="top">
        <td><code>medium.density*</code></td>
        <td>density distribution within the acoustic medium [kg/m^3]</td>
    </tr>    
	
    <tr valign="top">
        <td><code>medium.alpha_coeff_compression</code></td>
        <td>absorption coefficient for compressional waves [dB/(MHz^2 cm)]</td>
    </tr>   
    
	<tr valign="top">
        <td><code>medium.alpha_coeff_shear</code></td>
        <td>absorption coefficient for shear waves [dB/(MHz^2 cm)]</td>
    </tr>         
    
    <tr valign="top">
        <td>&nbsp</td>
        <td>&nbsp</td>
    </tr>       
    
    <tr valign="top">
        <td><code>source.p0*</code></td>
        <td>initial pressure within the acoustic medium</td>
    </tr>     
  
    <tr valign="top">
        <td><code>source.sxx</code></td>
        <td>time varying stress at each of the source positions given by <code>source.s_mask</code></td>
    </tr>      
    
    <tr valign="top">
        <td><code>source.syy</code></td>
        <td>time varying stress at each of the source positions given by <code>source.s_mask</code></td>
    </tr>   
    
    <tr valign="top">
        <td><code>source.szz</code></td>
        <td>time varying stress at each of the source positions given by <code>source.s_mask</code></td>
    </tr>   
    
    <tr valign="top">
        <td><code>source.sxy</code></td>
        <td>time varying stress at each of the source positions given by <code>source.s_mask</code></td>
    </tr>   
    
    <tr valign="top">
        <td><code>source.sxz</code></td>
        <td>time varying stress at each of the source positions given by <code>source.s_mask</code></td>
    </tr>   
    
    <tr valign="top">
        <td><code>source.syz</code></td>
        <td>time varying stress at each of the source positions given by <code>source.s_mask</code></td>
    </tr>       
    
    <tr valign="top">
        <td><code>source.s_mask</code></td>
        <td>binary matrix specifying the positions of the time varying stress source distributions</td>
    </tr>
	
	<tr valign="top">
        <td><code>source.s_mode</code></td>
        <td>optional input to control whether the input stress is injected as a mass source or enforced as a dirichlet boundary condition; valid inputs are <code>'additive'</code> (the default) or <code>'dirichlet'</code></td>
    </tr>	

    <tr valign="top">
        <td><code>source.ux</code></td>
        <td>time varying particle velocity in the x-direction at each of the source positions given by <code>source.u_mask</code></td>
    </tr>     

    <tr valign="top">
        <td><code>source.uy</code></td>
        <td>time varying particle velocity in the y-direction at each of the source positions given by <code>source.u_mask</code></td>
    </tr>      
    
    <tr valign="top">
        <td><code>source.uz</code></td>
        <td>time varying particle velocity in the z-direction at each of the source positions given by <code>source.u_mask</code></td>
    </tr>  

    <tr valign="top">
        <td><code>source.u_mask</code></td>
        <td>binary matrix specifying the positions of the time varying particle velocity distribution</td>
    </tr> 
	
	<tr valign="top">
        <td><code>source.u_mode</code></td>
        <td>optional input to control whether the input velocity is applied as a force source or enforced as a dirichlet boundary condition; valid inputs are <code>'additive'</code> (the default) or <code>'dirichlet'</code></td>
    </tr>	

    <tr valign="top">
        <td>&nbsp</td>
        <td>&nbsp</td>
    </tr>     
    
    <tr valign="top">
        <td><code>sensor.mask*</code></td>
        <td>binary matrix or a set of Cartesian points where the pressure is recorded at each time-step</td>
    </tr>    
    
	<tr valign="top">
        <td><code>sensor.record</code></td>
        <td>cell array of the acoustic parameters to record in the form <code>sensor.record = {'p', 'u', ...}</code>; valid inputs are:<br/>
        <code>&nbsp;&nbsp;'p'</code> (acoustic pressure)<br/>
        <code>&nbsp;&nbsp;'p_max'</code> (maximum pressure)<br/>
        <code>&nbsp;&nbsp;'p_min'</code> (minimum pressure)<br/>
        <code>&nbsp;&nbsp;'p_rms'</code> (RMS pressure)<br/>
        <code>&nbsp;&nbsp;'p_final'</code> (final pressure field at all grid points)<br/>
        <code>&nbsp;&nbsp;'p_max_all'</code> (maximum pressure at all grid points)<br/>
        <code>&nbsp;&nbsp;'p_min_all'</code> (minimum pressure at all grid points)<br/>
        <code>&nbsp;&nbsp;'u'</code> (particle velocity)<br/>
        <code>&nbsp;&nbsp;'u_max'</code> (maximum particle velocity)<br/>
        <code>&nbsp;&nbsp;'u_min'</code> (minimum particle velocity)<br/>
        <code>&nbsp;&nbsp;'u_rms'</code> (RMS particle velocity)<br/>
        <code>&nbsp;&nbsp;'u_final'</code> (final particle velocity field at all grid points)<br/>
        <code>&nbsp;&nbsp;'u_max_all'</code> (maximum particle velocity at all grid points)<br/>
        <code>&nbsp;&nbsp;'u_min_all'</code> (minimum particle velocity at all grid points)<br/>
        <code>&nbsp;&nbsp;'u_non_staggered'</code> (particle velocity on non-staggered grid)<br/>
		<code>&nbsp;&nbsp;'u_split_field'</code> (particle velocity on non-staggered grid split into compressional and shear components)<br/> 
        <code>&nbsp;&nbsp;'I'</code> (time varying acoustic intensity)<br/>
        <code>&nbsp;&nbsp;'I_avg'</code> (average acoustic intensity)<br/><br/>
        NOTE: the acoustic pressure outputs are calculated from the normal stress via p = -(sxx + syy + szz)/3</td>
    </tr>
    
    <tr valign="top">
        <td><code>sensor.record_start_index</code></td>
        <td>time index at which the sensor should start recording the data specified by <code>sensor.record</code> (default = 1)</td>
    </tr> 
    
    <tr valign="top">
        <td><code>sensor.time_reversal_boundary_data</code></td>
        <td>time varying pressure enforced as a Dirichlet boundary condition over <code>sensor.mask</code></td>
    </tr>      
     
</table>
    
<ul>
    <table cellspacing="0" class="note" summary="Note" cellpadding="5" border="1">
        <tr width="90%">
            <td><b>Note</b>&nbsp;&nbsp;For a heterogeneous medium, <code>medium.sound_speed_compression</code>, <code>medium.sound_speed_shear</code>, and <code>medium.density</code> must be given in matrix form with the same dimensions as <code>kgrid</code>. For a homogeneous medium, these can be given as scalar values.</td>
        </tr>
    </table>
</ul>

<h2>Optional Inputs</h2>

<p>Optional 'string', value pairs that may be used to modify the default computational settings.</p>

<table cellspacing="0" class="body" cellpadding="4" border="2">
    <colgroup>
        <col width="18%"><col width="18%"><col width="18%"><col width="46%">
    </colgroup>
    
    <thead>
        <tr valign="top">
            <th bgcolor="#B2B2B2">Input</th>
            <th bgcolor="#B2B2B2">Valid Settings</th>
            <th bgcolor="#B2B2B2">Default</th>
            <th bgcolor="#B2B2B2">Description</th>
        </tr>
    </thead>
    
    <tbody>

        <tr valign="top">
            <td bgcolor="#F2F2F2"><code>'CartInterp'</code></td>
            <td bgcolor="#F2F2F2"><code>'linear'</code><br><code>'nearest'</code></td>
            <td bgcolor="#F2F2F2"><code>'linear'</code></td>            
            <td bgcolor="#F2F2F2">Interpolation mode used to extract the pressure when a Cartesian sensor mask is given. If set to <code>'nearest'</code> and more than one Cartesian point maps to the same grid point, duplicated data points are discarded and <code>sensor_data</code> will be returned with less points than that specified by <code>sensor.mask</code>.</td>
        </tr>
    
        <tr valign="top">
            <td bgcolor="#F2F2F2"><code>'CreateLog'</code></td>
            <td bgcolor="#F2F2F2"><em>(Boolean scalar)</em></td>
            <td bgcolor="#F2F2F2"><code>false</code></td>            
            <td bgcolor="#F2F2F2">Boolean controlling whether the command line output is saved using the diary function with a date and time stamped filename.</td>
        </tr>        
        
        <tr valign="top">
            <td bgcolor="#F2F2F2"><code>'DataCast'</code></td>
            <td bgcolor="#F2F2F2"><em>(string of data type)</em></td>
            <td bgcolor="#F2F2F2"><code>'off'</code></td>            
            <td bgcolor="#F2F2F2">String input of the data type that variables are cast to before computation. For example, setting to <code>'single'</code> will speed up the computation time (due to the improved efficiency of <code><a href="matlab: doc fftn">fftn</a></code> and <code><a href="matlab: doc ifftn">ifftn</a></code> for this data type) at the expense of a loss in precision. This variable is also useful for utilising GPU parallelisation through libraries such as the Parallel Computing Toolbox by setting <code>'DataCast'</code> to <code>'gpuArray-single'</code>.</td>
        </tr>    
        
		<tr valign="top">
            <td bgcolor="#F2F2F2"><code>'DataRecast'</code></td>
            <td bgcolor="#F2F2F2"><em>(Boolean scalar)</em></td>
            <td bgcolor="#F2F2F2"><code>false</code></td>            
            <td bgcolor="#F2F2F2">Boolean controlling whether the output data is cast back to double precision. If set to false, <code>sensor_data</code> will be returned in the data format set using the <code>'DataCast'</code> option.</td>
        </tr>         
        
        <tr valign="top">
            <td bgcolor="#F2F2F2"><code>'DisplayMask'</code></td>
            <td bgcolor="#F2F2F2"><em>(binary matrix)</em> or<br/><code>'off'</code></td>
            <td bgcolor="#F2F2F2"><code>sensor.mask</code></td>            
            <td bgcolor="#F2F2F2">Binary matrix overlaid onto the animated simulation display. Elements set to 1 within the display mask are set to black within the display.</td>
        </tr>            

        <tr valign="top">
            <td bgcolor="#F2F2F2"><code>'MovieArgs'</code></td>
            <td bgcolor="#F2F2F2"><em>(string cell array)</em></td>
            <td bgcolor="#F2F2F2"><code>{}</code></td>            
            <td bgcolor="#F2F2F2">Settings for <code><a href="matlab: doc VideoWriter">VideoWriter</a></code>. Parameters must be given as {'param', value, ...} pairs within a cell array (default = {}), where 'param' corresponds to a writable property of a VideoWriter object.</td>
        </tr> 

        <tr valign="top">
            <td bgcolor="#F2F2F2"><code>'MovieName'</code></td>
            <td bgcolor="#F2F2F2"><em>(string)</em></td>
            <td bgcolor="#F2F2F2"><code>'date-time-kspaceFirstOrder3D'</code></td>            
            <td bgcolor="#F2F2F2">Name of the movie produced when <code>'RecordMovie'</code> is set to <code>true</code>.</td>
        </tr>
        
		<tr valign="top">
            <td bgcolor="#F2F2F2"><code>'MovieProfile'</code></td>
            <td bgcolor="#F2F2F2"><em>(string)</em></td>
            <td bgcolor="#F2F2F2"><code>'Uncompressed AVI'</code></td>            
            <td bgcolor="#F2F2F2">Profile input passed to <code><a href="matlab: doc VideoWriter">VideoWriter</a></code>.</td>
        </tr>
        
        <tr valign="top">
            <td bgcolor="#F2F2F2"><code>'PlotFreq'</code></td>
            <td bgcolor="#F2F2F2"><em>(integer numeric scalar)</em></td>
            <td bgcolor="#F2F2F2"><code>10</code></td>            
            <td bgcolor="#F2F2F2">The number of iterations which must pass before the simulation plot is updated.</td>
        </tr>        

        <tr valign="top">
            <td bgcolor="#F2F2F2"><code>'PlotPML'</code></td>
            <td bgcolor="#F2F2F2"><em>(Boolean scalar)</em></td>
            <td bgcolor="#F2F2F2"><code>true</code></td>            
            <td bgcolor="#F2F2F2">Boolean controlling whether the perfectly matched layer is shown in the simulation plots. If set to <code>false</code>, the PML is not displayed.<p></td>
        </tr>

        <tr valign="top">
            <td bgcolor="#F2F2F2"><code>'PlotScale'</code></td>
            <td bgcolor="#F2F2F2"><em>(numeric four element vector)</em> or<br><code>'auto'</code></td>
            <td bgcolor="#F2F2F2"><code>[-1, 1, -1, 1]</code></td>            
            <td bgcolor="#F2F2F2"><code>[sii_min, sii_max, sij_min, sij_max]</code> values used to control the scaling for <code><a href="matlab: doc imagesc">imagesc</a></code> (visualisation), where <code>sii</code> is the plot scale for the normal stress, and <code>sij</code> is the plot scale for the shear stress. If set to <code>'auto'</code>, a symmetric plot scale is chosen automatically for each plot frame.</td>
        </tr>            
        
        <tr valign="top">
            <td bgcolor="#F2F2F2"><code>'PlotSim'</code></td>
            <td bgcolor="#F2F2F2"><em>(Boolean scalar)</em></td>
            <td bgcolor="#F2F2F2"><code>true</code></td>            
            <td bgcolor="#F2F2F2">Boolean controlling whether the simulation iterations are progressively plotted.</td>
        </tr>            
        
        <tr valign="top">
            <td bgcolor="#F2F2F2"><code>'PMLAlpha'</code></td>
            <td bgcolor="#F2F2F2"><em>(numeric scalar or three element vector)</em></td>
            <td bgcolor="#F2F2F2"><code>2</code></td>            
            <td bgcolor="#F2F2F2">Absorption within the perfectly matched layer in Nepers per grid point.</td>
        </tr>        
        
        <tr valign="top">
            <td bgcolor="#F2F2F2"><code>'PMLInside'</code></td>
            <td bgcolor="#F2F2F2"><em>(Boolean scalar)</em></td>
            <td bgcolor="#F2F2F2"><code>true</code></td>            
            <td bgcolor="#F2F2F2">Boolean controlling whether the perfectly matched layer is inside or outside the grid. If set to <code>false</code>, the input grids are enlarged by <code>PMLSize</code> before running the simulation.</td>
        </tr>            
        
        <tr valign="top">
            <td bgcolor="#F2F2F2"><code>'PMLSize'</code></td>
            <td bgcolor="#F2F2F2"><em>(integer numeric scalar or three element vector)</em></td>
            <td bgcolor="#F2F2F2"><code>10</code></td>            
            <td bgcolor="#F2F2F2">Size of the perfectly matched layer in grid points. By default, the PML is added evenly to all sides of the grid, however, both <code>PMLSize</code> and <code>PMLAlpha</code> can be given as three element arrays to specify the x, y, and z properties, respectively. To remove the PML, set the appropriate <code>PMLAlpha</code> to zero rather than forcing the PML to be of zero size.</td>
        </tr>                  
        
        <tr valign="top">
            <td bgcolor="#F2F2F2"><code>'RecordMovie'</code></td>
            <td bgcolor="#F2F2F2"><em>(Boolean scalar)</em></td>
            <td bgcolor="#F2F2F2"><code>false</code></td>            
            <td bgcolor="#F2F2F2">Boolean controlling whether the displayed image frames are captured and stored as a movie using <code><a href="matlab: doc VideoWriter">VideoWriter</a></code> (default = false).</td>
        </tr>          
        
        <tr valign="top">
            <td bgcolor="#F2F2F2"><code>'Smooth'</code></td>
            <td bgcolor="#F2F2F2"><em>(Boolean scalar or three element vector)</em></td>
            <td bgcolor="#F2F2F2"><code>[true, false, false]</code></td>            
            <td bgcolor="#F2F2F2">Boolean controlling whether <code>source.p0</code>, <code>medium.sound_speed</code>, and <code>medium.density</code> are smoothed using <code><a href="smooth.html">smooth</a></code> before computation. <code>'Smooth'</code> can either be given as a single Boolean value or as a 3 element array to control the smoothing of <code>source.p0</code>, <code>medium.sound_speed</code>, and <code>medium.density</code>, independently.</td>
        </tr>      
        
        <tr valign="top">
            <td bgcolor="#F2F2F2"><code>'SaveToDisk'</code></td>
            <td bgcolor="#F2F2F2"><em>(string)</em></td>
            <td bgcolor="#F2F2F2"><code>''</code></td>            
            <td bgcolor="#F2F2F2">String containing a filename (including pathname if required). If set, after the precomputation phase, the input variables used in the time loop are saved the specified location in HDF5 format. The simulation then exits. The saved variables can be used to run simulations using the C++ code.</td>
        </tr>
                
    </tbody>
</table>

<h2>Outputs</h2>

<p>If <code>sensor.record</code> is not defined by the user:</p>

<table class="body">
    <tr valign="top">
        <td width = "150"><code>sensor_data</code></td>
        <td>time varying pressure recorded at the sensor positions given by <code>sensor.mask</code></td>
    </tr>  
</table>

<p>If <code>sensor.record</code> is defined by the user:</p>

<table class="body">
    <tr valign="top">
        <td width = "150"><code>sensor_data.p</code></td>
        <td>time varying pressure recorded at the sensor positions given by <code>sensor.mask</code> (returned if <code>'p'</code> is set)</td>
    </tr>
	<tr valign="top">
        <td width = "150"><code>sensor_data.p_max</code></td>
        <td>maximum pressure recorded at the sensor positions given by <code>sensor.mask</code> (returned if <code>'p_max'</code> is set)</td>
    </tr>
	<tr valign="top">
        <td width = "150"><code>sensor_data.p_min</code></td>
        <td>minimum pressure recorded at the sensor positions given by <code>sensor.mask</code> (returned if <code>'p_min'</code> is set)</td>
    </tr>      
	<tr valign="top">
        <td width = "150"><code>sensor_data.p_rms</code></td>
        <td>rms of the time varying pressure recorded at the sensor positions given by <code>sensor.mask</code> (returned if <code>'p_rms'</code> is set)</td>
    </tr>
    <tr valign="top">
        <td width = "150"><code>sensor_data.p_final</code></td>
        <td>final pressure field at all grid points within the domain (returned if <code>'p_final'</code> is set)</td>
    </tr>
	<tr valign="top">
        <td width = "150"><code>sensor_data.p_max_all</code></td>
        <td>maximum pressure recorded at all grid points within the domain (returned if <code>'p_max_all'</code> is set)</td>
    </tr>
	<tr valign="top">
        <td width = "150"><code>sensor_data.p_min_all</code></td>
        <td>minimum pressure recorded at all grid points within the domain (returned if <code>'p_min_all'</code> is set)</td>
    </tr>      
    <tr valign="top">
        <td width = "150"><code>sensor_data.ux</code></td>
        <td>time varying particle velocity in the x-direction recorded at the sensor positions given by <code>sensor.mask</code> (returned if <code>'u'</code> is set)</td>
    </tr>
    <tr valign="top">
        <td width = "150"><code>sensor_data.uy</code></td>
        <td>time varying particle velocity in the y-direction recorded at the sensor positions given by <code>sensor.mask</code> (returned if <code>'u'</code> is set)</td>
    </tr>
    <tr valign="top">
        <td width = "150"><code>sensor_data.uz</code></td>
        <td>time varying particle velocity in the z-direction recorded at the sensor positions given by <code>sensor.mask</code> (returned if <code>'u'</code> is set)</td>
    </tr> 
    <tr valign="top">
        <td width = "150"><code>sensor_data.ux_max</code></td>
        <td>maximum particle velocity in the x-direction recorded at the sensor positions given by <code>sensor.mask</code> (returned if <code>'u_max'</code> is set)</td>
    </tr>
	<tr valign="top">
        <td width = "150"><code>sensor_data.uy_max</code></td>
        <td>maximum particle velocity in the y-direction recorded at the sensor positions given by <code>sensor.mask</code> (returned if <code>'u_max'</code> is set)</td>
    </tr>
	<tr valign="top">
        <td width = "150"><code>sensor_data.uz_max</code></td>
        <td>maximum particle velocity in the z-direction recorded at the sensor positions given by <code>sensor.mask</code> (returned if <code>'u_max'</code> is set)</td>
    </tr>   
    <tr valign="top">
        <td width = "150"><code>sensor_data.ux_min</code></td>
        <td>minimum particle velocity in the x-direction recorded at the sensor positions given by <code>sensor.mask</code> (returned if <code>'u_min'</code> is set)</td>
    </tr>
	<tr valign="top">
        <td width = "150"><code>sensor_data.uy_min</code></td>
        <td>minimum particle velocity in the y-direction recorded at the sensor positions given by <code>sensor.mask</code> (returned if <code>'u_min'</code> is set)</td>
    </tr>
	<tr valign="top">
        <td width = "150"><code>sensor_data.uz_min</code></td>
        <td>minimum particle velocity in the z-direction recorded at the sensor positions given by <code>sensor.mask</code> (returned if <code>'u_min'</code> is set)</td>
    </tr>     
    <tr valign="top">
        <td width = "150"><code>sensor_data.ux_rms</code></td>
        <td>rms of the time varying particle velocity in the x-direction recorded at the sensor positions given by <code>sensor.mask</code> (returned if <code>'u_rms'</code> is set)</td>
    </tr>
    <tr valign="top">
        <td width = "150"><code>sensor_data.uy_rms</code></td>
        <td>rms of the time varying particle velocity in the y-direction recorded at the sensor positions given by <code>sensor.mask</code> (returned if <code>'u_rms'</code> is set)</td>
    </tr>
    <tr valign="top">
        <td width = "150"><code>sensor_data.uz_rms</code></td>
        <td>rms of the time varying particle velocity in the z-direction recorded at the sensor positions given by <code>sensor.mask</code> (returned if <code>'u_rms'</code> is set)</td>
    </tr>
    <tr valign="top">
        <td width = "150"><code>sensor_data.ux_final</code></td>
        <td>final particle velocity field in the x-direction at all grid points within the domain (returned if <code>'u_final'</code> is set)</td>
    </tr>
    <tr valign="top">
        <td width = "150"><code>sensor_data.uy_final</code></td>
        <td>final particle velocity field in the y-direction at all grid points within the domain (returned if <code>'u_final'</code> is set)</td>
    </tr>
    <tr valign="top">
        <td width = "150"><code>sensor_data.uz_final</code></td>
        <td>final particle velocity field in the z-direction at all grid points within the domain (returned if <code>'u_final'</code> is set)</td>
    </tr>
    <tr valign="top">
        <td width = "150"><code>sensor_data.ux_max_all</code></td>
        <td>maximum particle velocity in the x-direction recorded at all grid points within the domain (returned if <code>'u_max_all'</code> is set)</td>
    </tr>
	<tr valign="top">
        <td width = "150"><code>sensor_data.uy_max_all</code></td>
        <td>maximum particle velocity in the y-direction recorded at all grid points within the domain (returned if <code>'u_max_all'</code> is set)</td>
    </tr>
	<tr valign="top">
        <td width = "150"><code>sensor_data.uz_max_all</code></td>
        <td>maximum particle velocity in the z-direction recorded at all grid points within the domain (returned if <code>'u_max_all'</code> is set)</td>
    </tr>   
    <tr valign="top">
        <td width = "150"><code>sensor_data.ux_min_all</code></td>
        <td>minimum particle velocity in the x-direction recorded at all grid points within the domain (returned if <code>'u_min_all'</code> is set)</td>
    </tr>
	<tr valign="top">
        <td width = "150"><code>sensor_data.uy_min_all</code></td>
        <td>minimum particle velocity in the y-direction recorded at all grid points within the domain (returned if <code>'u_min_all'</code> is set)</td>
    </tr>
	<tr valign="top">
        <td width = "150"><code>sensor_data.uz_min_all</code></td>
        <td>minimum particle velocity in the z-direction recorded at all grid points within the domain (returned if <code>'u_min_all'</code> is set)</td>
    </tr>       
    <tr valign="top">
        <td width = "150"><code>sensor_data.ux_non_staggered</code></td>
        <td>time varying particle velocity in the x-direction recorded at the sensor positions given by <code>sensor.mask</code> after shifting to the non-staggered grid (returned if <code>'u_non_staggered'</code> is set)</td>
    </tr>
    <tr valign="top">
        <td width = "150"><code>sensor_data.uy_non_staggered</code></td>
        <td>time varying particle velocity in the y-direction recorded at the sensor positions given by <code>sensor.mask</code> after shifting to the non-staggered grid (returned if <code>'u_non_staggered'</code> is set)</td>
    </tr>
    <tr valign="top">
        <td width = "150"><code>sensor_data.uz_non_staggered</code></td>
        <td>time varying particle velocity in the z-direction recorded at the sensor positions given by <code>sensor.mask</code> after shifting to the non-staggered grid (returned if <code>'u_non_staggered'</code> is set)</td>
    </tr>
    <tr valign="top">
        <td width = "150"><code>sensor_data.ux_split_p</code></td>
        <td>compressional component of the time varying particle velocity in the x-direction on the non-staggered grid recorded at the sensor positions given by <code>sensor.mask</code> (returned if <code>'u_split_field'</code> is set)</td>
    </tr>
    <tr valign="top">
        <td width = "150"><code>sensor_data.ux_split_s</code></td>
        <td>shear component of the time varying particle velocity in the x-direction on the non-staggered grid recorded at the sensor positions given by <code>sensor.mask</code> (returned if <code>'u_split_field'</code> is set)</td>
    </tr>
    <tr valign="top">
        <td width = "150"><code>sensor_data.uy_split_p</code></td>
        <td>compressional component of the time varying particle velocity in the y-direction on the non-staggered grid recorded at the sensor positions given by <code>sensor.mask</code> (returned if <code>'u_split_field'</code> is set)</td>
    </tr>
    <tr valign="top">
        <td width = "150"><code>sensor_data.uy_split_s</code></td>
        <td>shear component of the time varying particle velocity in the y-direction on the non-staggered grid recorded at the sensor positions given by <code>sensor.mask</code> (returned if <code>'u_split_field'</code> is set)</td>
    </tr>
    <tr valign="top">
        <td width = "150"><code>sensor_data.uz_split_p</code></td>
        <td>compressional component of the time varying particle velocity in the z-direction on the non-staggered grid recorded at the sensor positions given by <code>sensor.mask</code> (returned if <code>'u_split_field'</code> is set)</td>
    </tr>
    <tr valign="top">
        <td width = "150"><code>sensor_data.uz_split_s</code></td>
        <td>shear component of the time varying particle velocity in the z-direction on the non-staggered grid recorded at the sensor positions given by <code>sensor.mask</code> (returned if <code>'u_split_field'</code> is set)</td>
    </tr>
    <tr valign="top">
        <td width = "150"><code>sensor_data.Ix</code></td>
        <td>time varying acoustic intensity in the x-direction recorded at the sensor positions given by <code>sensor.mask</code> (returned if <code>'I'</code> is set)</td>
    </tr>
    <tr valign="top">
        <td width = "150"><code>sensor_data.Iy</code></td>
        <td>time varying acoustic intensity in the y-direction recorded at the sensor positions given by <code>sensor.mask</code> (returned if <code>'I'</code> is set)</td>
    </tr>
    <tr valign="top">
        <td width = "150"><code>sensor_data.Iz</code></td>
        <td>time varying acoustic intensity in the z-direction recorded at the sensor positions given by <code>sensor.mask</code> (returned if <code>'I'</code> is set)</td>
    </tr>	
    <tr valign="top">
        <td width = "150"><code>sensor_data.Ix_avg</code></td>
        <td>average acoustic intensity in the x-direction recorded at the sensor positions given by <code>sensor.mask</code> (returned if <code>'I_avg'</code> is set)</td>
    </tr>
    <tr valign="top">
        <td width = "150"><code>sensor_data.Iy_avg</code></td>
        <td>average acoustic intensity in the z-direction recorded at the sensor positions given by <code>sensor.mask</code> (returned if <code>'I_avg'</code> is set)</td>
    </tr>
    <tr valign="top">
        <td width = "150"><code>sensor_data.Iz_avg</code></td>
        <td>average acoustic intensity in the z-direction recorded at the sensor positions given by <code>sensor.mask</code> (returned if <code>'I_avg'</code> is set)</td>
    </tr>	
</table>

<h2>Examples</h2>
<ul>
<li><a href="example_ewp_3D_simulation.html">Simulations In Three Dimensions</a></li>
</ul>

<h2>See Also</h2>

<code><a href="kspaceFirstOrder3D.html">kspaceFirstOrder3D</a></code>, <code><a href="kWaveGrid.html">kWaveGrid</a></code>, <code><a href="pstdElastic2D.html">pstdElastic2D</a></code>

</div></body></html>